package be.nepherte.movmanager.domain;

import java.io.Serializable;
import java.util.List;

/**
 * UserInfo represents all the necessary information needed on the client about
 * a user and his or her login. It is used for keeping authentication
 * information and personalization of this application. Each UserInfo object
 * has:
 * <ul>
 * <li>a nickname</li>
 * <li>an email address</li>
 * <li>a login status indication</li>
 * <li>an url to log in and out</li>
 * </ul>
 * All of this information is retrieved from the Google Account Service.
 * 
 * <p>
 * Copyright © 2010 Bart Verhoeven
 * </p>
 * 
 * <p>
 * This file is part of MovManager.
 * </p>
 * 
 * <p>
 * MovManager is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * </p>
 * 
 * <p>
 * MovManager is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * </p>
 * 
 * <p>
 * You should have received a copy of the GNU General Public License along with
 * MovManager. If not, see <a
 * href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses</a>.
 * </p>
 * 
 * @author	Bart Verhoeven
 * @version	0.1
 */
public class UserInfo implements Serializable {
	private static final long serialVersionUID = 1L;
	/**Indicates whether this user is logged in or not.*/
	private boolean loggedIn;
	/**The url to log in of movmanager.*/
	private String loginUrl;
	/**The url to log out of movmanager.*/
	private String logoutUrl;
	/**The user's email address.*/
	private String emailAddress;
	/**The user's nickname.*/
	private String nickname;
	/**The user's id.**/
	private String id;
	private List<Movie> movies;

	/**
	 * Default empty constructor required by the Google RFC protocol.
	 */
	public UserInfo() {}
	
	/**
	 * Constructor for this UserInfo.
	 *  
	 * @param	id
	 * 			the user id
	 * @param 	nickname
	 * 			the user's nickname
	 * @param 	emailAddress
	 * 			the user's email address
	 * @param 	loggedIn
	 * 			the user's login status
	 * @param	loginUrl
	 * 			the url to log in
	 * @param 	logoutUrl
	 * 			the url to log out
	 */
	public UserInfo(String id,String nickname, String emailAddress, boolean loggedIn, String loginUrl, String logoutUrl) {
		this.id = id;
		this.nickname = nickname;
		this.emailAddress = emailAddress;
		this.loggedIn = loggedIn;
		this.loginUrl = loginUrl;
		this.logoutUrl = logoutUrl;
	}
	
	/**
	 * Gets the user id.
	 * 
	 * @return	id
	 */
	public String getId() {
		return id;
	}

	/**
	 * Returns whether the user is logged in or not wit his/her
	 * Google account.
	 * 
	 * @return	true if logged in, false otherwise
	 */
	public boolean isLoggedIn() {
		return loggedIn;
	}

	/**
	 * Retrieves the url to log in. The url refers to a Google page
	 * where you can log in with your Google account.
	 * 
	 * @return	loginUrl
	 */
	public String getLoginUrl() {
		return loginUrl;
	}

	/**
	 * Retrieves the url to log out. The url refers to a Google page
	 * where the user will be logged out automatically.
	 * 
	 * @return	logoutUrl
	 */
	public String getLogoutUrl() {
		return logoutUrl;
	}


	/**
	 * Retrieves the user's email address. This is the email attached
	 * to his/her Google account.
	 * 
	 * @return	emailAddress
	 */
	public String getEmailAddress() {
		return emailAddress;
	}

	/**
	 * Retrieves the user's nickname. This is the nickname attached to
	 * his/her Google account.
	 * 
	 * @return	nickname
	 */
	public String getNickname() {
		return nickname;
	}
	
	/**
	 * Retrieves the user's movie collection.
	 * 
	 * @return	movies
	 */
	public List<Movie> getMovies() {
		return movies;
	}
	
	public void setMovies(List<Movie> movies){
		this.movies = movies;
	}
}
